package com.example.ormsqlsplicingframe1.orm.registry;

import java.lang.reflect.Field;

public class RegistryBoolean implements Registry<Boolean,String>{

    @Override
    public Boolean decode(String value, Field field) {

        if (field.getType() == Boolean.class){
            if (value.equals("1"))return true;
            if (value.equals("0"))return false;
            return Boolean.parseBoolean(value);
        }

        return null;
    }

    @Override
    public Class<Boolean> getObj() {
        return Boolean.class;
    }
}
